package com.wuchao.test;

import lombok.extern.slf4j.Slf4j;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 * @Author wuchao66
 * @Date 2022/7/4 14:34
 * @Version 1.0
 */
@Slf4j
public class TJNDI {
    public static void main(String[] args) {
        try {
            Context ct=new InitialContext();//得到上下文对象
            String lookup = (String) ct.lookup("java:comp/env/t151");
            System.out.println(lookup);
        } catch (NamingException e) {
            e.printStackTrace();
        }
    }
}
